using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.DirectX.Direct3D;
using Microsoft.DirectX;
using System.Drawing;
using GameFramework;
using GameEngine;

namespace Projet_X0
{
    public class LogoMesh : IMesh
    {
        private Texture logoTexture = null;
        private Sprite logoSprite = null;

        public LogoMesh()
        {
            
        }

        public override void Render()
        {
            Point position = new Point((Display.HRES - logoTexture.GetLevelDescription(0).Width) / 2, (Display.VRES - logoTexture.GetLevelDescription(0).Height) / 2);
            logoSprite.Begin(SpriteFlags.AlphaBlend);
            logoSprite.Draw2D(logoTexture, Point.Empty, 0, position, Color.White.ToArgb());
            logoSprite.End();
        }

        public override void Terminate()
        {
            logoSprite.Dispose();
            logoTexture.Dispose();
        }

        public override void Init()
        {
            logoTexture = TextureLoader.FromFile(Display.grfDevice, ((Persistance)GameManager.GetServices().persistance).LoadMesh((int)EntityID.Logo), 0, 0, 0, Usage.None, Format.A8B8G8R8, Pool.Managed, Filter.None, Filter.None, Color.White.ToArgb());
            logoSprite = new Sprite(Display.grfDevice);
        }

    }
}
